<?php
/*
 * File: confirmation.php
 * Created: 21 июля 2007
 * Author: Andrew Dashin <dash@andrewdashin.com>
 * 
 * Description:
 *
 */
 
 if (isset($_GET['confirmationcode']) and $_GET['confirmationcode'] != '') {
    $db = MySQL::getInstance();
    if ($db->fetchAssoc(
            $db->sql("SELECT * FROM `users` WHERE `confirmation_code` = ':0' and `email_confirmed` = 0")->bind($_GET['confirmationcode'])
            )) {
                // update users
                $db->sql("UPDATE `users` SET `active` = 1, `confirmation_code` = '0', `email_confirmed` = 1 WHERE `confirmation_code` = ':0'")->bind($_GET['confirmationcode']);
                $message = "Registration has been confirmed, now you can log in";
            } else {
                $message = "Wrong Confirmation Code";
            }
 } else {
     $message = "Wrong Confirmation Code!";
 }
?>
